package com.ckg.bean.etds;

import com.ckg.bean.Vehicle;
import org.jspecify.annotations.Nullable;
import org.springframework.beans.factory.FactoryBean;

// FactoryBean
public class TruckFactoryBean implements FactoryBean<Vehicle> {
    private String type;
    private double loadCapacity;

    //setter方法用于属性注入
    public void setType(String type) {
        this.type = type;
    }

    public void setLoadCapacity(double loadCapacity) {
        this.loadCapacity = loadCapacity;
    }

    @Override
    public Truck getObject() {
        return new Truck(type, loadCapacity);
    }

    @Override
    public @Nullable Class<?> getObjectType() {
        return null;
    }

    @Override
    public boolean isSingleton() {
        return true;
    }
}